<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="author" content="lushu">
		<title>现金录入</title>
		<script language="javascript" type="text/javascript" src="../script/print.js"></script>
		<script language="javascript" src="../script/common.js" type="text/javascript"></script>
		<script language="javascript" src="../script/card.js" type="text/javascript"></script>
		<script language="javascript" type="text/javascript">
			var Page;
			var data
			var org = Common.cOrg();		//当前单位
			  with(p=new   Date())  
  			{  
 					 setDate(getDate()-1)  
  			} 
		
		TX.TrueOrFalse = {
			flag: //是否
		     [  2,
		         1],
		    flag2:
			[1,
			     2]
		};	
			
			function initPageElements(){
				Page.readonlyTableStyle = "col2 label8";
					Common.initDict(Page.operationForm.TrueOrFalse,Common.getSubsetItems("true_false",TX.TrueOrFalse.flag));
					Common.initDict(Page.operationForm.accCode,TX.AccountType.deposit());
					Common.initDict(Page.operationForm.giftId,"gift_item");
					
					operationForm.orgID.value = org.id;
					operationForm.organization.value = org.name;
					//searchForm.orgLevel.value = org.orgLevel;
					
					operationForm.recordTime.value = p.format("yyyy-MM-dd")
					return true;
				
			Page.bill = "trade_in_bill";
			Page.preResult = function(result){
				showInformation("充值成功");

			}
//				Page.postResult = function(){
//					if(Page.userInfo.cardUser.invoiceType == InvoiceType.DEPOSIT)
//						TX.Invoice.saveInvoice(Page.userInfo.cardUser.uniqueId
//											 , 0
//											 , Page.amountInSystem(data.amount)
//											 );
//				}
			}

			//更改优惠方式
			function changeDiscount(obj){
				var giftId;
				if (obj)
					giftId = obj.value;
				var extraInput = "";
				if(giftId==100001 || giftId==100002){
					Common.initDict(Page.operationForm.TrueOrFalse,Common.getSubsetItems("true_false",TX.TrueOrFalse.flag2));
				}
				else
				Common.initDict(Page.operationForm.TrueOrFalse,Common.getSubsetItems("true_false",TX.TrueOrFalse.flag));
			}

		//选择机构方法
			function searchSelOrg(){
				SystemMgnt.selOrg(function(sorg) {
						operationForm.organization.value = sorg.name;
						operationForm.orgID.value = sorg.id;
					});
			}
			
			function docashInput(){
				if(!checkForm(operationForm))
					return;
				data = Common.getValues(Page.operationForm);
				var confirmString = "操作员编号:" + data.oper+ TX.SHOW_INFO_LINEBREAK
									+"受理机构:" + data.organization+ TX.SHOW_INFO_LINEBREAK
									+"交易金额:" + data.amount+ TX.SHOW_INFO_LINEBREAK
									+"比数:" + data.txno+ TX.SHOW_INFO_LINEBREAK
									+"交易日期:" + data.recordTime+ TX.SHOW_INFO_LINEBREAK
									+"餐别:" + Common.getText('gift_item',data.giftId) + TX.SHOW_INFO_LINEBREAK
									+"是否优惠:" +  Common.getText('true_false',data.TrueOrFalse)+ TX.SHOW_INFO_LINEBREAK;
				if(showQuestion(confirmString)){
					try{
					DWR.syncCall("expandCardTxService.cashInput",
							data.oper,
							data.orgID,
							Format.yuanToFen(data.amount),
							data.txno,
							data.giftId,
							data.recordTime,
							data.TrueOrFalse
						)
						showInformation("现金交易录入成功");
						Page.operationForm.amount.value="";
						Page.operationForm.txno.value="";
						Page.operationForm.oper.value="";
						Page.operationForm.amount.focus();
						}catch(e){
					showError(e.description)
					}
				}else{
					Page.operationForm.amount.value="";
					Page.operationForm.amount.focus();
				}
			}
			
		</script>
	</head>
	<body onload="TX.NoCardTrade.init()">
		<div class="nav"><div id="nav">&nbsp;</div></div>
		
		<div id="operationFormDiv" >
			<div class="form">
				<div class="formTitle">现金录入</div>	
				<form id="operationForm" name="operationForm">
					<input type="hidden" name="orgID"/>
					<span id="readonlyInfo"></span>
					<table cellSpacing="0" cellPadding="4" width="100%" border="0" class="col2 label8">

						<tr>
							<td><label>操作员编号</label> <input type="text" name="oper" onblur="checkV(this,'number',true)"><span class="des">*</span></td>
							<td>
								<label>受理机构&nbsp;&nbsp;</label>
								<input type="text" name="organization" maxlength="20" readonly class="readonly"><a class="orga" href="#" onclick="searchSelOrg();">&nbsp;&nbsp;</a>
							</td>
						</tr>

						<tr>
							<td><label>交易金额</label> <input type="text" name="amount"onblur="checkV(this,'positiveAmount',true)"><span class="des">*</span></td>
							<td><label>餐别</label> <select name="giftId" onchange="changeDiscount(this)"><option></option></select></td>
							
						</tr>
						<tr>
							<td><label>是否优惠</label> <select name="TrueOrFalse"><option></option></select></td>
							<td><label>比数</label> <input type="text" name="txno" maxlength="8" onblur="checkV(this,'int',true)"><span class="des">*</span></td>
						</tr>
						<tr>
							<td><label>交易日期</label> <input type="text" name="recordTime" readonly class="readonly"></td>
							<td><button id="operation" onclick="docashInput()">录 入</button></td>
						</tr>
					</table>
					<div id="payTypeArea"></div>
					<p>
						
						
						<!--<button onclick="TX.NoCardTrade.goFirstPage()">返 回</button>-->
					</p>
				</form>
			</div>
		</div>
			

	</body>
</html>